{extend name="public:_base" /}
{block name="css"}
{load href="__STATIC__/admin/uploadify/uploadify.css" /}
<script type="text/css">
    .clearfix:after{content:"\20";display:block;height:0;clear:both;visibility:hidden}.clearfix{zoom:1}
    .tabBar {border-bottom: 2px solid #222}
    .tabBar span {background-color: #e8e8e8;cursor: pointer;display: inline-block;float: left;font-weight: bold;height: 30px;line-height: 30px;padding: 0 15px}
    .tabBar span.current{background-color: #222;color: #fff}
    .tabCon {display: none}
</script>
{/block}
{block name="js"}
{include file="public/_validform"}
<!--上传配置 -->
<script src="__STATIC__/admin/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/upfile.js" type="text/javascript"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__/admin/hui/lib/ueditor/1.4.3/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/admin/hui/lib/ueditor/1.4.3/ueditor.all.js"></script>
<!--验证-->
<script type="text/javascript">
    var ue = UE.getEditor('editor');
    var ue = UE.getEditor('editor3');
    var ue = UE.getEditor('editor2',{
        toolbars: [
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ],
        initialFrameHeight:150,
    });

    $("[name='cid']").find("[value='{$data.cid ?? ''}']").attr("selected", true);
    $("[name='cid']").find("[value='{$data.cid ?$data.cid :$Request.param.addcid }']").attr("selected", true);

    $("[name='tuijian'][value='{$data.tuijian ?? '1'}']").attr("checked", true);
    $("[name='status'][value='{$data.status ?? '1'}']").attr("checked", true);
    $("[name='hot'][value='{$data.hot ?? '1'}']").attr("checked", true);

    upload_image('image','','476','267','500');
    upload_image('icon','','476','267','500');

    var URL = {
        uploader: '{:url('Upload/image')}',
        swf:'__STATIC__/admin/uploadify/uploadify.swf',
        ROOT:'__PUBLIC__/uploads/image',
        del_url:'{:url('Product/delimage')}',
    }
    jQuery.Huitab =function(tabBar,tabCon,class_name,tabEvent,i){
        var $tab_menu=$(tabBar);
        // 初始化操作
        $tab_menu.removeClass(class_name);
        $(tabBar).eq(i).addClass(class_name);
        $(tabCon).hide();
        $(tabCon).eq(i).show();

        $tab_menu.bind(tabEvent,function(){
            $tab_menu.removeClass(class_name);
            $(this).addClass(class_name);
            var index=$tab_menu.index(this);
            $(tabCon).hide();
            $(tabCon).eq(index).show()})}
    $(function(){
        $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0")});
</script>
{/block}
{block name="main"}

<div class="page-container">
    
    <form class="form form-horizontal" action="{:url(\''.\\think\\Request::instance()->controller().'/save')}" id="form" method="post">
        
        <table class="table table-border table-bordered table-bg table-style">
            <thead>
                <tr>
                    <th colspan="2" scope="col">填写信息</th>
                </tr>
            </thead>
            
            <tbody>
            {include file="public:_navadd"}

                <tr>
                    <th>
                        <span class="c-red">*</span>名称：
                    </th>
                    <td>
                        <input type="text" class="input-text" value="{$data.title ?? ''}" placeholder="产品名称" name="title" datatype="*" nullmsg="请填写产品名称">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        <span class="c-red">*</span>规格：
                    </th>
                    <td>
                        <input type="text" class="input-text" value="{$data.seo_title ?? ''}" placeholder="产品规格" name="seo_title" datatype="*" nullmsg="请填写产品规格">
                    </td>
                </tr>
                <tr>
                    <th>
                        价格：
                    </th>
                    <td>
                        <input type="number" class="input-text" value="{$data.jiaqian ?? ''}" placeholder="" name="jiaqian" min="0.00" step="0.01">
                    </td>
                </tr>
                <tr>
                    <th>
                        商城链接：
                    </th>
                    <td>
                        <input type="url" class="input-text" value="{$data.url ?? ''}" placeholder="商城链接" name="url"  nullmsg="商城链接">
                    </td>
                </tr>

                <tr>
                    <th>
                        <span class="c-red">*</span>参数：
                    </th>
                    <td>
                        <script id="editor2" type="text/plain" name="parameter" style="width:100%;height:300px;">{$data.parameter|default=''|html_entity_decode ?? ''}</script>
                    </td>
                </tr>

                
                <tr>
                    <th>
                        图片：300*300：
                    </th>
                    <td>
                        <div id="image_s">
                            <img src="__PUBLIC__/uploads/{$data.image ?'image/'.$data.image: 'sm_300.jpg'}" width="200px" height="200px"/>
                        </div>
                        <input id="image_post" name="image" type="hidden" value="{$data.image ?? ''}"/>
                        <input name="old_image" type="hidden" value="{$data.image ?? ''}"/>
                        <input id="image" name="image_upload" type="file" multiple="true">
                    </td>
                </tr>
                <tr>
                    <th>
                        产品图标：300*300：
                    </th>
                    <td>
                        <div id="icon_s">
                            <img src="__PUBLIC__/uploads/{$data.icon ?'image/'.$data.icon: 'sm_300.jpg'}" width="200px" height="200px"/>
                        </div>
                        <input id="icon_post" name="icon" type="hidden" value="{$data.icon ?? ''}"/>
                        <input name="old_icon" type="hidden" value="{$data.icon ?? ''}"/>
                        <input id="icon" name="icon_upload" type="file" multiple="true">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        多图片：
                    </th>

                    <td>
                        <div id="s_s">
                            {volist name="data.images|default=''" id="vo"}
                            <div class="uploads-box">
                                <a href="__PUBLIC__/uploads/image/{$vo.image}" target="_blank" title="查看">
                                    <img class="uploads-img" src="__PUBLIC__/uploads/image/{$vo.image}">
                                </a>

                                <input name="images[]" value="{$vo.image}" type="hidden">

                                <a class="uploads-del" onclick="delfile(this,'{$vo.image}');" title="删除">
                                    <i class="Hui-iconfont">&#xe6e2;</i>
                                </a>
                            </div>
                            {/volist}
                        </div>

                        <div class="clear"></div>

                        <input id="s" name="duo" type="file" multiple="true">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        排序值：
                    </th>
                    <td>
                        <input type="number" class="input-text" value="{$data.sort ?? ''}" placeholder="" id="articlesort" name="sort">
                        <div style="font-size: 14px;float: left;margin: 5px 0 0 0;">
                            <span class="c-red">*</span>  不填写, 默认排序为最高
                        </div>
                    </td>
                </tr>
                
                <tr>
                    <th>
                        <span class="c-red">*</span>关键词：
                    </th>
                    <td>
                        <input type="text" class="input-text" value="{$data.key ?? ''}" placeholder="" id="keywords" name="key"  datatype="*" nullmsg="请填写关键词">
                    </td>
                </tr>
                
                <tr>
                    <th>
                        <span class="c-red">*</span>摘要：
                    </th>
                    <td class="textarea-valid">
                        <textarea name="miaoshu" class="input-text textarea" placeholder="说点什么...最少输入10个字符" datatype="*5-300" dragonfly="true" nullmsg="备注不能为空！">{$data.miaoshu ?? ''}</textarea>
                    </td>
                </tr>
                
                <tr>
                    <th>
                        发布者：
                    </th>
                    <td>
                        <input type="text" class="input-text" value="{$data.issue ?? ''}" placeholder="" id="author" name="issue">
                    </td>
                </tr>
                                <tr>
                                <th>
                                状态：
                            </th>
                            <td>
                            <div class="radio-box">
                                <input type="checkbox" name="status"  value="1">
                                <label for="radio-0">前台显示</label>
                                </div>
                                <div class="radio-box">
                                <input type="checkbox" name="hot"  value="1">
                                <label for="radio-0">热销</label>
                                </div>

                                <div class="radio-box radio-right">
                                <input type="checkbox" name="tuijian" value="1">
                                <label for="radio-1">推荐</label>
                                </div>
                                </td>
                            </th>

                <tr>
                    <td colspan="2" >
                        <div id="tab_demo" class="HuiTab">
                            <div class="tabBar clearfix"><span role="tab" class="current">内容详细</span><span role="tab" class="">产品特点</span></div>
                            <div class="tabCon" role="tabpanel" style="display: block;">
                                <script id="editor" type="text/plain" name="center" style="width:100%;height:300px;">{$data.center|default=''|html_entity_decode ?? ''}</script>
                            </div>
                            <div class="tabCon" role="tabpanel" style="display: none;">
                                <script id="editor3" type="text/plain" name="point" style="width:100%;height:300px;">{$data.point|default=''|html_entity_decode ?? ''}</script>
                            </div>
                        </div>
                    </td>
                </tr>
            </tbody>
            
            <tfoot>
                <tr class="text-c">
                    <td colspan="2">
                        {:token()}
                        <input type="hidden"  value="{$data.id ?? ''}" name="id">
                        <input type="hidden" value="{$data.cid ?? $addcid}" name="cidold" />
                        <input class="btn radius btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                        <input class="btn radius btn-default radius" type="reset" value="&nbsp;&nbsp;重置&nbsp;&nbsp;">
                        <!-- <button onClick="layer_close();" class="btn radius btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button> -->
                    </td>
                </tr>
            </tfoot>
        </table>
        
    </form>
    
</div>
{/block}

